package com.lcs.config.rule;

//import com.netflix.client.config.IClientConfig;
//import com.netflix.loadbalancer.AbstractLoadBalancerRule;
//import com.netflix.loadbalancer.ILoadBalancer;
//import com.netflix.loadbalancer.Server;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.concurrent.ThreadLocalRandom;

@Component
public class MyRandomRule {
//    @Override extends AbstractLoadBalancerRule
//    public void initWithNiwsConfig(IClientConfig iClientConfig) {
//
//    }
//
//    @Override
//    public Server choose(Object key) {
//        ILoadBalancer loadBalancer = this.getLoadBalancer();
//        List<Server> reachableServers = loadBalancer.getReachableServers();
//        int i = ThreadLocalRandom.current().nextInt(reachableServers.size());
//        Server server = reachableServers.get(i);
//        return server;
//    }
}
